<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_personal.*" %>
<%@page import="java.util.*" %>
<%@page import="com.lmpop.trade.tb_commpara.*" %>
<%@page import="com.lmpop.trade.ts_custclass.*" %>
<%@page import="com.lmpop.trade.ts_area.*" %>
<%@page import="com.lmpop.trade.ti_custlevel.*" %>
<html>
  <head>
    
    <title>会员管理</title>
	<link href="/program/company/index/css/style.css" rel="stylesheet" type="text/css">
	<script language="javascript" type="text/javascript" src="/program/plugins/calendar/WdatePicker.js"></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/interface/Ts_areaInfo.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/interface/Ts_categoryInfo.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/interface/Tb_commparaInfo.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/engine.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/util.js'></script>
	<script type='text/javascript' src='js_personal.js'></script>	
</head>

<body>

  <% 
  	String cust_id="",user_id="";	
	if( session.getAttribute("session_cust_id") != null )
	{
		cust_id = session.getAttribute("session_cust_id").toString();
	}
	if( session.getAttribute("session_user_id") != null )
	{
		user_id = session.getAttribute("session_user_id").toString();
	}
	Ts_areaInfo areaBean = new Ts_areaInfo();
  	
	Ti_custlevelInfo custLevelInfo = new Ti_custlevelInfo();
	List custLevel_list = custLevelInfo.getListByPk(cust_id);
	Hashtable custLevel_map = new Hashtable();	
	if(custLevel_list!=null && custLevel_list.size()>0) custLevel_map = (Hashtable)custLevel_list.get(0);
	
	String cust_start_date = "";
	if(custLevel_map.get("cust_start_date")!=null){
	cust_start_date = custLevel_map.get("cust_start_date").toString();
	if(cust_start_date.length()>10)cust_start_date=cust_start_date.substring(0,10);
	}
	String cust_end_date = "";
	if(custLevel_map.get("cust_end_date")!=null){
	cust_end_date = custLevel_map.get("cust_end_date").toString();
	if(cust_end_date.length()>10)cust_end_date=cust_end_date.substring(0,10);
	}	
			
	
	Tb_commparaInfo tb_commparaInfo=new Tb_commparaInfo();
	String _income = tb_commparaInfo.getSelectItem("20","");	
  	Ti_personalInfo ti_personalInfo = new Ti_personalInfo();
  	List list = ti_personalInfo.getListByPk(cust_id);
  	Hashtable map = new Hashtable();
  	if(list!=null && list.size()>0) map = (Hashtable)list.get(0);
  	
  	String nike_name="",phone="",email="",user_class="",cellphone="",fax="",qq="",msn="",post_code="",address="",sex="",birth="",area_attr="",marry="",blood_type="",career="",job="",hobby="",income="",in_date="",pub_user_id="",remark="";
  	String state_code = "",cust_name="",user_type="";
	if(map.get("user_class")!=null) user_class = map.get("user_class").toString();
	if(map.get("state_code")!=null) state_code = map.get("state_code").toString();
	if(map.get("user_type")!=null) user_type = map.get("user_type").toString();
	if(map.get("cust_name")!=null) cust_name = map.get("cust_name").toString();
	if(map.get("nike_name")!=null) nike_name = map.get("nike_name").toString();
  	if(map.get("phone")!=null) phone = map.get("phone").toString();
  	if(map.get("email")!=null) email = map.get("email").toString();
  	if(map.get("cellphone")!=null) cellphone = map.get("cellphone").toString();
  	if(map.get("fax")!=null) fax = map.get("fax").toString();
  	if(map.get("qq")!=null) qq = map.get("qq").toString();
  	if(map.get("msn")!=null) msn = map.get("msn").toString();
  	if(map.get("post_code")!=null) post_code = map.get("post_code").toString();
  	if(map.get("address")!=null) address = map.get("address").toString();
  	if(map.get("sex")!=null) sex = map.get("sex").toString();
  	if(map.get("birth")!=null) birth = map.get("birth").toString();
  	if(map.get("area_attr")!=null) area_attr = map.get("area_attr").toString();
  	if(map.get("marry")!=null) marry = map.get("marry").toString();
  	if(map.get("blood_type")!=null) blood_type = map.get("blood_type").toString();
  	if(map.get("career")!=null) career = map.get("career").toString();
  	if(map.get("job")!=null) job = map.get("job").toString();
  	if(map.get("hobby")!=null) hobby = map.get("hobby").toString();
  	if(map.get("income")!=null) income = map.get("income").toString();
  	if(map.get("in_date")!=null) in_date = map.get("in_date").toString();
  	if(map.get("pub_user_id")!=null) pub_user_id = map.get("pub_user_id").toString();
  	if(map.get("remark")!=null) remark = map.get("remark").toString();
	
	Map custclassinfoMap = new Hashtable();
	custclassinfoMap.put("class_type","1");	
	Ts_custclassInfo custclassinfo = new Ts_custclassInfo();
	String custclass_name =  custclassinfo.getcust_class_name(user_class);
	 String areaAttr = "",classAttr = "";
			
		if (map.get("area_attr") != null) {
		area_attr = map.get("area_attr").toString();
		String areaArr[] = area_attr.split("\\|");
		for( int k = 0; k < areaArr.length; k++ ){
			areaAttr = areaAttr + " &nbsp; " + areaBean.getAreaNameById( areaArr[k]);
		}
	}	

  %>
	
	<h1>修改个人会员信息</h1>
	
	
	<form action="/doTradeReg.do" method="post" name="addForm">
	<table width="100%" cellpadding="0" cellspacing="1" border="0" class="listtab">

		<tr>
			<td align="right" width="10%">
				会员名称
			</td>
			<td width="30%" colspan="3"><input name="cust_name" id="cust_name" value="<%=cust_name%>"  type="hidden" maxlength="20"/>
			<%=cust_name%></td>

		</tr>
		
		<tr>
			<td align="right" width="10%">
				会员昵称<font color="red">*</font>
			</td>
			<td width="30%"><input name="nike_name" id="nike_name" value="<%=nike_name%>"  type="text" maxlength="20"/></td>

			<td align="right" width="10%">
				会员级别
			</td>
			<td>
			<%=custclass_name%>
			<input type="hidden" name="user_class" id="user_class" value="<%=user_class%>">
			<input type="hidden" name="cust_class" id="cust_class" value="<%=user_class%>">
		</tr>
			<tr>
				<td align="right" width="10%">
					服务开始时间:
				</td>
				<td  >
				
				<%=cust_start_date%>
				</td>

				<td align="right" width="10%">
					服务结束时间:
				</td>
				
				<td >
					<%=cust_end_date%></td>
			</tr>	
		<tr>
			<td align="right" width="10%">
				固话:
			</td>
			<td width="30%"><input name="phone" id="phone" value="<%=phone%>"  type="text"  maxlength="20" onKeyUp="if(!/^[0-9][0-9]*$/.test(this.value))this.value=''"/></td>
			<td align="right" width="10%">
				手机:
			</td>
			<td><input name="cellphone" id="cellphone" value="<%=cellphone%>" type="text"  maxlength="20" onKeyUp="if(!/^[0-9][0-9]*$/.test(this.value))this.value=''"/></td>			
		</tr>
		
		<tr>
			<td align="right" width="10%">
				Email:
			</td>
			<td><input name="email" id="email"  value="<%=email%>"  type="text"  maxlength="20"/></td>
			<td align="right" width="10%">
				传真:
			</td>
			<td><input name="fax" id="fax"  value="<%=fax%>" type="text"  maxlength="20" onKeyUp="if(!/^[0-9][0-9]*$/.test(this.value))this.value=''"/></td>
		</tr>

		
		<tr>
			<td align="right" width="10%">
				QQ:
			</td>
			<td><input name="qq" id="qq" type="text" value="<%=qq%>"  maxlength="20" onKeyUp="if(!/^[0-9][0-9]*$/.test(this.value))this.value=''"/></td>
			<td align="right" width="10%">
				MSN:
			</td>
			<td><input name="msn" id="msn" value="<%=msn%>" type="text"  maxlength="20"/></td>			
		</tr>
		<tr>
	<td align="right" width="10%">
				邮政编码:
			</td>
			<td><input name="post_code" id="post_code"  value="<%=post_code%>"  type="text"  maxlength="10" onKeyUp="if(!/^[0-9][0-9]*$/.test(this.value))this.value=''"/></td>

			<td align="right" width="10%">
				是否已婚:
			</td>
			<td>				<input name="marry" id="marry" value="0" <%if(marry.equals("0")){%> checked<%}%> type="radio" />未婚
				<input name="marry" id="marry" value="1" <%if(marry.equals("1")){%> checked<%}%> type="radio" />已婚</td>			
		</tr>
		<tr>
		
			<td align="right" width="10%">
				所在地区<font color="red">*</font>
			</td>
			<td width="30%">
				<div id="org1">
					<font color="#CECECE"><%=areaAttr%></font>
					<input type="button" name="buttons" value="修改地区" class="buttoncss" onClick="ChangeOrg()" />
				</div>
				<div style="display:none;" id="org2">
					<select name="province" id="province" onclick="setCitys(this.value)">
					  <option value="">省份</option> 
					</select>
					<select name="eparchy_code" id="eparchy_code" onclick="setAreas(this.value)">
					  <option value="">地级市</option> 
					 </select>
					<select name="city_code" id="city_code" style="display:inline" >
					 <option value="">市、县级市、县</option> 
					</select>
				</div>
					<input type="hidden" name="area_attr_bak" id="area_attr_bak" value="<%=area_attr%>" />
					<input type="hidden" name="area_attr" id="area_attr" value="" />
				</td>


			<td align="right" width="10%">
				地址:
			</td>
			<td><input name="address" id="address" type="text" value="<%=address%>" size="30"  maxlength="100"/></td>
						
		</tr>
		
		<tr>
			<td align="right" width="10%">
				性别:
			</td>
			<td>
			<input name="sex" id="sex" value="0" <%if(sex.equals("0")){%> checked<%}%> type="radio" />男
			<input name="sex" id="sex" value="1" <%if(sex.equals("1")){%> checked<%}%>  type="radio" />女</td>
			<td align="right" width="10%">
				出生日期:
			</td>
			<td><input name="birth" id="birth"  size="15" type="text" value="<%=birth%>" onFocus="WdatePicker()" style="width:145px" class="Wdate" maxlength="15" /></td>			
		</tr>
		

		<tr>
			<td align="right" width="10%">
				血型:
			</td>
			<td>
			<select name="blood_type" id="blood_type" >
			<option value="">请选择</option>
			<option value="0" <%if(blood_type.equals("0")){%>selected<%}%>>O型</option>
			<option value="1" <%if(blood_type.equals("1")){%>selected<%}%>>A型</option>
			<option value="2" <%if(blood_type.equals("2")){%>selected<%}%>>B型</option>
			<option value="3" <%if(blood_type.equals("3")){%>selected<%}%>>AB型</option>
			
			</select></td>
			<td align="right" width="10%">
				教育程度:
			</td>
			<td><input name="career" id="career" type="text" value="<%=career%>"  maxlength="50"/></td>			
		</tr>
		

		
		<tr>
			<td align="right" width="10%">
				工作:
			</td>
			<td><input name="job" id="job" type="text" value="<%=job%>"  maxlength="50"/></td>
		<td align="right" width="10%">
				爱好:
			</td>
			<td><input name="hobby" id="hobby" type="text" value="<%=hobby%>" maxlength="50"/></td>			
		</tr>
		

		
		<tr>
			<td align="right" width="10%">
				收入:
			</td>
			<td><select name="income" id="income" ><%=_income%></select></td>

			<td align="right" width="10%">
				备注:
			</td>
			<td><input name="remark" id="remark" type="text" value="<%=remark%>" maxlength="50"/></td>
		</tr>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td align="center">
				<input type="hidden" name="bpm_id" value="8204" />
	  			<input type="hidden" name="cust_id" value="<%=cust_id %>" />
				<input type="hidden" name="cust_type" value="1" />
				<input type="hidden" name="user_type" id="user_type" value="<%=user_type%>" />
				<input type="hidden" name="state_code" value="<%=state_code%>" />
				<input type="button" class="buttoncss" name="tradeSub" value="提交" onClick="subForm();"/>&nbsp;&nbsp;
			</td>
		</tr>
	</table>
	</form>
</body>

</html>
